package com.yanqu.road.server.cmd.activity.suitang;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.suitang.SuiTang;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.suitang.CrossSuiTangMgr;
import com.yanqu.road.server.manager.activity.suitang.activity.CrossSuiTangActivity;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = CrossProtocol.C2_SUI_TANG_GET_MEMBER_SOLDIER, desc = "获取成员兵力")
public class CrossSuiTangGetMemberSoldierCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {

        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        SuiTang.CrossSuiTangReqMsg reqMsg = SuiTang.CrossSuiTangReqMsg.parseFrom(packet.getBytes());
        CrossSuiTangActivity activity = CrossSuiTangMgr.getActivity(reqMsg.getActivityId(), groupId);
        if (activity == null) {
            return;
        }
        SuiTang.SuiTangGetMemberSoldierRespMsg.Builder resp = activity.getMemberSoldier(packet.getPlayerId());
        MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(GameProtocol.S_SUI_TANG_GET_MEMBER_SOLDIER % 20000, resp));
    }

    @Override
    public void sendData() {

    }
}
